<template>
	<view style="background-color: rgb(247,247,247);padding: 20upx;min-height: 100vh;">
		<view class="course" v-for="(item ,index) in truancyList" :key="index">
			<view class="time">
				创建时间：{{item.time}}
			</view>
			<view class="bodyer">
				<image :src="item.user_pic||'/static/head_img.jpeg'" mode=""></image>
				<view class="bodyer_text">
					<view class="top">
						<view class="name">
							{{item.user_name||'没名字'}}
						</view>
						<view class="phone">
							{{item.tel}}
						</view>
					</view>
					<view class="bottom">
						请假时间：{{item.time_a}}
					</view>
				</view>
			</view>
			<view class="" style="display: flex; margin: 0 30upx;margin-bottom: 20upx;">
				<view class="course_left">
					<u-time-line>
						<u-time-line-item class="" nodeTop="8">
							<template v-slot:content>
								<view style="height: 40upx;position: relative;bottom: 10upx;">
									<view class="startTime">{{item.time_s}}</view>

								</view>
							</template>
						</u-time-line-item>
						<u-time-line-item nodeTop="18">
							<template v-slot:content>
								<view style="height: 20upx;">
									<view class="overTime">{{item.time_s_en}}</view>
								</view>
							</template>
						</u-time-line-item>
					</u-time-line>
				</view>

				<view class="course_right">
					<view class="title">
						<view class="">
							{{item.title}}
						</view>
						<view class="">
							{{item.user}}
						</view>
					</view>
					<view class="address">
						<u-icon name="map-fill" color="#a7a7a7" size="30"></u-icon>
						{{item.add}}
					</view>
				</view>
			</view>
			<!-- 		<view class="" style="height: 80upx;width: 100%;padding-top: 10upx;" v-if="item.class_status==1">
			<view class="rest2" @click="navRoute(item.id)">
				设置补课时间
			</view>
			<view class="rest1" v-if="item.time_en" @click="cleansing(item.id)">
				已补课
			</view>
	
		</view> -->

			<view :class="item.bu_time_s?(item.class_status==2?'okConfirm resultTime':'confirm resultTime'):'resultTime'">
				补课时间：<text>{{item.bu_time_s?`${item.bu_time_en} ${item.bu_time_s} ~ ${item.bu_time_s_en}`:'未定'}}</text> <text v-if="item.class_status==2" style=" float: right;">已补</text>
			</view>
		</view>
		<u-empty v-if="!truancyList.length" text="暂无请假信息" mode="list" margin-top="200"></u-empty>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				truancyList: []

			}
		},
		onLoad() {
			this.newData()
		},
		methods: {
			newData() {
				this.$myRuquest('home/user/truancy_list').then(res => {
					if (res.code == 400) {
						this.truancyList = res.data
						this.truancyList.forEach(item => {
							item.bu_time_en = this.$util._date_time(+item.bu_time_en * 1000)
							item.time = this.$util._date_time(+item.time * 1000, true)
							item.time_a = item.time_a.replace(item.time_s, '')
						})
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.resultTime {
		padding: 20upx;
		font-size: 26upx;
		border-top: 1upx solid #F4F5F7;

		text {
			font-size: 30upx;
			font-weight: 900;
			color: rgb(251, 49, 90);
		}
	}

	.confirm {
		color: #fff;
		background: linear-gradient(to right, rgb(253, 190, 136), rgb(251, 49, 90));
		border: none;
		text {
			color: #fff;
		}
	}
	.okConfirm{
		color: #fff;
		background: #ccc;
		border: none;
		text {
			color: #fff;
		}
	}

	.time {
		position: absolute;
		top: 25upx;
		right: 20upx;
		font-size: 22upx;
		color: #b2b2b2;
	}

	.reminder {
		padding: 30upx 20upx 0 20upx;
	}

	.bodyer {
		display: flex;
		margin: 0 30upx;
		margin-bottom: 20upx;

		image {
			width: 80upx;
			height: 80upx;
			border-radius: 50%;
			margin-right: 20upx;
		}

		.bodyer_text {
			.top {
				display: flex;

				.name {
					font-weight: 900;
					margin-right: 20upx;
				}
			}

			.bottom {
				font-size: 24upx;
				color: #b2b2b2;
				margin-top: 10upx;
			}
		}
	}

	.course {
		// display: flex;
		width: calc(100% -20upx);
		margin: 20upx 0;
		padding-top: 20upx;
		position: relative;
		background-color: #fff;
		border-radius: 12upx;
		overflow: hidden;

		.course_left {
			margin-right: 20upx;
			flex: 1;
			margin-bottom: 0upx;

			.startTime,
			.overTime {
				font-size: 36upx;
				font-weight: 900;

				text {
					color: #ccc;
					font-size: 20upx;
					margin-right: 10upx;
					position: relative;
					bottom: 8upx;
				}
			}
		}

		.course_right {
			flex: 4;
			position: relative;
			bottom: 6upx;

			.title {
				// padding-top: 10upx;
				width: 400upx;
				font-weight: 900;

				view:nth-child(1) {
					color: #000;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				view:nth-child(2) {
					font-size: 22upx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					color: #003c7c;
					margin: 5upx 0;
				}
			}

			.address {
				color: #888888;
				width: 500upx;
				font-size: 26upx;
				position: absolute;
				bottom: 0upx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}


		.rest1 {
			background-color: #007AFF;
			color: #fff;
			border-radius: 10upx;
			padding: 10upx 20upx;
			font-weight: 900;
			text-align: center;
			width: 150upx;
			margin-right: 20upx;
			float: right;
		}

		.rest2 {
			background-color: rgb(254, 28, 77);
			color: #fff;
			border-radius: 10upx;
			padding: 10upx 20upx;
			font-weight: 900;
			width: 220upx;
			float: right;
		}
	}
</style>
